Back to BASIC
By Grant Kwai
Copyright (c) 1992 Apple Users' Group, Sydney
Republished from Applecations, a publication of the Apple Users' Group, Sydney, Australia.
CONTinue -One of the forgotten commands in Applesoft basic. Few people seem to be aware of its existence and those that are seem to neglect its benefits. Used in conjunction with several other commands, it can improve debugging programs immensely.
Why not try this simple program. After typing it in, type RUN to execute it.
100 PRINT "THIS IS A TEST MESSAGE"
110 STOP:PRINT
120 PRINT "LOOK, THIS LINE IS EXECUTING!"
When you are put back into the DOS prompt (the ']' symbol), type CONT. You should see the following:
-------------------------------
THIS IS A TEST MESSAGE
BREAK IN 110
]CONT
LOOK, THIS LINE IS EXECUTING!
-------------------------------
You would have noticed that you were able to CONTinue running your program after you exited your program. The error line "Break in 110" tells you where the program had stopped.
You will also note there is a carriage return (blank line) after typing CONT. This is because CONT executes the very next command *after* the STOP, even those on the same line. In our case, it was a PRINT statement. If you don't believe me, try this program.
5 PRINT "PRESS <CTRL>-C TO BREAK PROGRAM AND CONT TO CONTINUE"
10 FOR N=1 TO 1000
20 PRINT N : NEXT N
If you interrupt this program by pressing <control>-C, you will get an error message "Break in line 20". If you then type CONT, it will continue printing numbers in succession as if nothing happened. For example, if you stopped the program when it had finished printing 34, after the CONT statement, it will proceed print the numbers at 35.
An alternative to the STOP command is END. Try the following program, remembering to type CONT at the dos prompt when run.
10 PRINT "THIS IS ANOTHER TEST"
20 END : PRINT
30 PRINT "LOOK, A DIFFERENCE!"
You will note on execution of this program, that there is no "BREAK" error message. This is the only difference between the STOP and END statements when used with CONT. You may prefer to use END if you don't want the error statement to be printed for some reason.
The STOP/CONT or END/CONT functions can be very beneficial if you want to check a section of code to see if it worked correctly. Assuming it was correct, you can then continue running your program as if nothing has happened.
There are some instances when you can not continue running a program after it has stopped. One of these is if an illegal function is run. Try this.
10 PRINT "PROGRAM WILL PRINT THIS"
20 A%=40000
30 PRINT "PROGRAM WONT PRINT THIS"
When you RUN this program, you will get:
-----------------------------
PROGRAM WILL PRINT THIS
?SYNTAX IN LINE 20
]CONT
?CAN'T CONTINUE ERROR
------------------------------
This is because A%=40000 is an illegal value. A% must be an integer value (the % denotes an integer variable) and the maximum integer value is 32767.
When you type CONT you get a "?CAN'T CONTINUE ERROR" due to the fact there is an error in your program.
Hence, you can only CONTinue if there is nothing wrong with the syntax of your program.
CONT will only work if typed directly *after* the STOP/END command has been executed. If you typed the following program and ran it, you would get:
10 PRINT "A MESSAGE"
20 STOP:PRINT
30 PRINT "ANOTHER MESSAGE"
-----------------------
A MESSAGE
]CATALOGUE
?SYNTAX ERROR
]CONT
?CAN'T CONTINUE ERROR
------------------------
Any command at the STOP/END dos prompt will invalidate the CONT function. This even includes valid dos commands (e.g. CATALOG). Modifying the program in any way also invalidates the CONT function.
More DOS commands shall be investigated in the next "Back to BASIC".

THIS CONTENT COPYRIGHT © 2007, APPLE MACINTOSH USERS' GROUP, SYDNEY
Permission has been obtained to make this material available on the Internet.

Permission is hereby granted for non-profit user groups to republish this content.
PLEASE CREDIT THE AUTHOR AND THE SOURCE: Applecations, publication of the Apple Users' Group, Sydney, Australia

THIS PAGE COPYRIGHT © 2007, ANDREW ROUGHAN